/*** Create consistent class of worker variable ***/
/*** Use edited variables whenever possible ***/
/*** The variable classer2 includes the self-employed, incorporated into private ***/
/*** Up to 1989, the variable classer includes the self-employed, incorporated into private ***/
/*** From 1989 on, the variable classer corresponds to the variable classer1 in the documentation ***/


gen class_new=.

replace class_new=1 if (year>=1979 & year<=1988) & (classer==1 & class~=5)
replace class_new=2 if (year>=1979 & year<=1988) & (classer==2)
replace class_new=3 if (year>=1979 & year<=1988) & (classer==1 & class==5)
replace class_new=3 if (year>=1979 & year<=1988) & (classer==3)
replace class_new=4 if (year>=1979 & year<=1988) & (classer==4)

replace class_new=1 if (year>=1989 & year<=1993) & (classer==1)
replace class_new=2 if (year>=1989 & year<=1993) & (classer>=2 & classer<=4)
replace class_new=3 if (year>=1989 & year<=1993) & (classer>=5 & classer<=6)
replace class_new=4 if (year>=1989 & year<=1993) & (classer==7)

replace class_new=1 if (year>=1994 & year<=2020) & (class94>=4 & class94<=5)
replace class_new=2 if (year>=1994 & year<=2020) & (class94>=1 & class94<=3)
replace class_new=3 if (year>=1994 & year<=2020) & (class94>=6 & class94<=7)
replace class_new=4 if (year>=1994 & year<=2020) & (class94==8)

drop class classer classer2 
cap drop class94
rename class_new class
label define class 1 "Private" 2 "Government" 3 "Self-employed" 4 "Without pay"
label values class class
